/**
 * 角色详情对话框
 */
var DeptInfoDlg = {
    data: {
        pid: "",
        pName: ""
    }
};

layui.use(['layer', 'form', 'admin', 'ax', 'layedit'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var layer = layui.layer;
    var layedit = layui.layedit;

    layedit.set({
        uploadImage: {
            url: Feng.uploadPreUrl + 'V1.0.0/api/file/lay-uploadWebEditor' //接口url
            ,type: 'post' //默认post
        }
    });
    layedit.build('getContentStr'); //建立编辑器

    // 表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var ajax = new $ax(Feng.ctxPath + "/category/set-content", function (data) {
            if (data.success) {
                Feng.success("设置成功！");

                //传给上个页面，刷新table用
                admin.putTempData('formOk', true);

                //关掉对话框
                admin.closeThisDialog();
            }
        }, function (data) {
            Feng.error("修改失败！" + data.responseJSON.message)
        });
        data.field.content = layedit.getContent(1);
        ajax.set(data.field);
        ajax.start();
        return false;
    });
});
